package com.hyt.it.ogt.pj.feign;

import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.it.ogt.pj.model.dto.StudentExtendDTO;
import com.hyt.it.ogt.pj.model.entity.ApiFail;
import com.hyt.it.ogt.pj.model.entity.PaperItemFile;
import com.hyt.it.ogt.pj.model.entity.Project;
import com.hyt.it.ogt.pj.model.entity.Subject;
import com.hyt.it.ogt.pj.model.param.MarkCandidateParam;
import com.hyt.it.ogt.pj.model.vo.*;
import com.hyt.loginfo.config.OAuth2FeignRequestConfig;
import com.hyt.model.PageParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 林坚丁
 * @date 2020/5/8 15:24
 * @Description
 */
@FeignClient(value = "it-ogt-kz", contextId = "it-ogt-kw", fallbackFactory = KwClientHystrix.class, configuration = OAuth2FeignRequestConfig.class)
public interface KwClient {

    /**
     * 获取考试任务的列表信息
     *
     * @param projectName
     * @param markStatus
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/api/pj/exam/getProject")
    ApiResponse<PageParam<ProjectVo>> getAllProject(@RequestParam("projectName") String projectName, @RequestParam("markStatus") String markStatus, @RequestParam("current") long current, @RequestParam("size") long size);

    /**
     * 根据id获取评卷的任务详细信息
     *
     * @param projectId
     * @return
     */
    @GetMapping("/api/pj/exam/getProjectInfo")
    ApiResponse<Project> getProjectById(@RequestParam("projectId") String projectId);


    /**
     * 获取科目列表
     *
     * @param projectId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/pj/exam/getSubjects")
    ApiResponse<List<Subject>> getSubjects(@RequestParam("projectId") String projectId, @RequestParam(value = "admissionNumber", required = false) String admissionNumber);

    /**
     * 获取试卷
     *
     * @param projectId
     * @param subjectId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/pj/exam/getPapers")
    ApiResponse<List<PackageDataVO>> getPapers(@RequestParam("projectId") String projectId, @RequestParam("subjectId") String subjectId, @RequestParam(value = "admissionNumber", required = false) String admissionNumber);

    /**
     * 获取考生信息
     *
     * @param projectId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/pj/exam/getSubjectStudent")
    ApiResponse<List<StudentExtendDTO>> getProjectStudent(@RequestParam("projectId") String projectId, @RequestParam(value = "admissionNumber", required = false) String admissionNumber);


    /**
     * 分页获取考生列表
     *
     * @param projectId
     * @return
     */
    @GetMapping("/api/pj/exam/getSubjectStudentByPaging")
    ApiResponse<PageParam<StudentExtendDTO>> getProjectStudentPage(@RequestParam("projectId") String projectId, @RequestParam(value = "current", required = false) Integer current, @RequestParam(value = "size", required = false) Integer size);


    /**
     * 获取考生答案
     *
     * @param projectId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/pj/exam/getStudentAnswer")
    ApiResponse<List<StudentAnswerVo>> getStudentAnswer(@RequestParam("projectId") String projectId, @RequestParam(value = "admissionNumber", required = false) String admissionNumber);

    /**
     * 获取考生客观分
     *
     * @param projectId
     * @param admissionNumber
     * @return
     */
    @GetMapping("/api/pj/exam/getKgScore")
    ApiResponse<List<ObjectiveScoreVO>> getKgScore(@RequestParam("projectId") String projectId, @RequestParam(value = "admissionNumber", required = false) String admissionNumber);

    /**
     * 获取考生试卷客观分
     *
     * @param projectId
     * @param admissionNumber
     * @param paperId
     * @param paperVersion
     * @return
     */
    @GetMapping("/api/pj/exam/getPaperKgScore")
    ApiResponse<ObjectiveScoreVO> getPaperKgScore(@RequestParam("projectId") String projectId, @RequestParam(value = "admissionNumber", required = false) String admissionNumber, @RequestParam(value = "paperId", required = false) String paperId, @RequestParam(value = "paperVersion", required = false) Integer paperVersion);

    /**
     * 打标记
     *
     * @return
     */
    @PutMapping("/api/pj/exam/markCandidate")
    ApiResponse markCandidate(@RequestBody MarkCandidateParam params);

    /**
     * 获取增量考生
     *
     * @param projectId
     * @return
     */
    @PutMapping("/api/pj/exam/getIncrementCandidate")
    ApiResponse getIncrementCandidate(@RequestParam("projectId") String projectId);

    /**
     * 更新考务评卷状态
     *
     * @param updateCandidateJudgeStateVO
     * @return
     */
    @PutMapping("/api/pj/exam/updateCandidateJudgeState")
    ApiResponse updateCandidateJudgeState(@RequestBody UpdateCandidateJudgeStateVO updateCandidateJudgeStateVO);

    /**
     * 取消评卷标记状态
     *
     * @param projectId
     * @param admissionNumbers
     * @return
     */
    @PutMapping("/api/pj/exam/cancelCandidateJudgeState")
    ApiResponse cancelCandidateJudgeState(@RequestParam("projectId") String projectId, @RequestParam("admissionNumbers") List<String> admissionNumbers);

    /**
     * 查询api调用失败的参数
     */
    @GetMapping("/api/pj/exam/apifail/list")
    ApiResponse<List<ApiFail>> apiFailList(@RequestParam("api") String api);

    /**
     * 删除api调用失败的记录
     */
    @DeleteMapping("/api/pj/exam/apifail/delete")
    ApiResponse<Object> apiFailDelete(@RequestParam("idArrayJson") String idArrayJson);

    /**
     * 设置学生缺席与否状态
     */
    @GetMapping("/api/pj/exam/updateCandidateAbsent")
    ApiResponse<Object> updateCandidateAbsent(@RequestParam("projectId") String projectId, @RequestParam("admissionNumber") String admissionNumber, @RequestParam("state") Integer state);


    @GetMapping("/api/pj/exam/getKgScoreForPaper")
    ApiResponse<ObjectiveScoreVO> getKgScoreForPaper(@RequestParam("examId") String projectId, @RequestParam("admissionNumber") String admissionNumber
            , @RequestParam("paperId") String paperId, @RequestParam("paperVersion") String paperVersion);

    /**
     * 获取试卷音视频文件列表
     *
     * @param paperId
     * @param paperVersion
     * @return
     */
    @GetMapping("/api/pj/exam/getPaperItemFileData")
    ApiResponse<List<PaperItemFile>> getPaperItemFileData(@RequestParam String paperId,
                                                          @RequestParam String paperVersion);

    /**
     * 更新推送评卷数据状态变更
     *
     * @param id
     * @param status
     * @param error
     */
    @GetMapping("/api/pj/exam/pjPushUpdateStatus")
    void updateStatus(@RequestParam Long id, @RequestParam Integer status, @RequestParam(required = false) String error);

    /**
     * 删除推送评卷数据
     *
     * @param pushId
     */
    @GetMapping("/api/pj/exam/pjPushDelete")
    void delete(@RequestParam Long pushId);
}
